const { merge } = require('webpack-merge');
const ComConfig = require('./webpack.common');
const path = require('path')

const devConfig = {
    mode: 'development',
    // devtool: 'eval-cheap-module-source-map',
    devServer: {
        contentBase: path.join(__dirname, "dist"),
        compress: true,
        port: 9000,
        open: true,
        hot: true, // 开启HMR
        overlay: {   // 页面报错提示
            warnings: true,
            errors: true
        }
    },
    module: {
        rules: [{
            test: /\.(vue|js|jsx)$/,
            loader: 'eslint-loader',
            enforce: "pre", // 编译前检查
            exclude: /node_modules/, // 不检测的文件
            include: [path.resolve(__dirname, 'src')], // 指定检查的目录
            options: {
                formatter: require('eslint-friendly-formatter'),
                emitWarning: true,
                fix: true
            }
        }],
    },

    optimization: {
        usedExports: true
    }
}
module.exports = merge(devConfig, ComConfig)